import service from "@/utils/request.js";

/**
 * @name 查询员工
 * @param {*} data
 * @returns
 */
export const querySysUser = (data) => {
  return service({
    url: "/jy-system/sysUser/querySysUser",
    method: "post",
    data,
  });
};
/**
 * @name 删除员工
 * @param {*} sysUserId 
 * @returns 
 */
export const deleteSysUser = (sysUserId) => {
  return service({
    url: "/jy-system/sysUser/deleteSysUser",
    method: "get",
    params:{
      sysUserId
    }
  });
};

/**
 * @name 员工操作
 * @param {*} data
 * @returns
 */
export const operationSysUser = (data) => {
  return service({
    url: "/jy-system/sysUser/operationSysUser",
    method: "post",
    data,
  });
};

/**
 * @name 查询员工详情
 * @param {*} userId
 * @returns
 */
export const querySysUserDetail = (userId) => {
  return service({
    url: "jy-system/sysUser/querySysUserDetail",
    method: "get",
    params: {
      userId,
    },
  });
};

/**
 * @name 改变员工状态
 * @param {*} data
 * @returns
 */
export const changeSysUserStatus = (params) => {
  return service({
    url: "/jy-system/sysUser/changeSysUserStatus",
    method: "get",
    params,
  });
};

/**
 * @name 部门列表
 * @param {*} data
 * @returns
 */
export const queryDepartmentListPage = (
  data = { page: { size: 9999, current: 1 } }
) => {
  return service({
    url: "/jy-system/department/queryDepartmentListPage",
    method: "post",
    data,
  });
};

/**
 * @name 操作部门
 * @param {*} data
 * @returns
 */
export const operationDepartment = (data) => {
  return service({
    url: "/jy-system/department/operationDepartment",
    method: "post",
    data,
  });
};
/**
 * @name 删除部门
 * @param {*} departmentId
 * @returns
 */
export const deleteDepartment = (departmentId) => {
  return service({
    url: "/jy-system/department/deleteDepartment",
    method: "get",
    params: {
      departmentId,
    },
  });
};

/**
 * @name 角色列表
 * @param {*} data
 * @returns
 */
export const queryRoleList = (data = { page: { size: 9999, current: 1 }, clientType: 0 }) => {
  return service({
    url: "/jy-system/role/queryRoleList",
    method: "post",
    data,
  });
};

/**
 * @name 新增角色
 * @param {*} data
 * @returns
 */
export const addRole = (data) => {
  return service({
    url: "/jy-system/role/addRole",
    method: "post",
    data,
  });
};

/**
 * @name 修改角色
 * @param {*} data
 * @returns
 */
export const modifyRole = (data) => {
  return service({
    url: "/jy-system/role/modifyRole",
    method: "post",
    data,
  });
};

/**
 * @name 查看角色详情
 * @param {*} roleId
 * @returns
 */
export const queryRoleDetails = (roleId) => {
  return service({
    url: "/jy-system/role/queryRoleDetails",
    method: "get",
    params: { roleId },
  });
};

/**
 * @name 删除角色
 * @param {*} roleId
 * @returns
 */
export const deleteRole = (roleId) => {
  return service({
    url: "/jy-system/role/deleteRole",
    method: "get",
    params: {
      roleId,
    },
  });
};
/**
 * @name  修改角色状态
 * @param {*} params
 * @returns
 */
export const changeRoleStatus = (params) => {
  return service({
    url: "/jy-system/role/changeRoleStatus",
    method: "get",
    params,
  });
};

/**
 * @name 获取所有路由权限
 * @param {*} data
 * @returns
 */
export const getSysPermissionList = (
  data = { page: { size: 9999, current: 1},permissionClient: 1  }
) => {
  return service({
    url: "/jy-system/permission/getSysPermissionList",
    method: "post",
    data,
  });
};

/**
 * @name 获取当前用户路由
 * @returns
 */
export const getRouters = () => {
  return service({
    url: "/jy-system/permission/getRouters",
    method: "get",
  });
};

/**
 * @name 查询数据分组列表
 * @param {*} data
 * @returns
 */
export const queryDataPermissionList = (data) => {
  return service({
    url: "/jy-system/sysDataPermission/queryDataPermissionList",
    method: "post",
    data,
  });
};

/**
 * @name 新增数据分组权限
 * @param {*} data
 * @returns
 */
export const operationDataPermission = (data) => {
  return service({
    url: "/jy-system/sysDataPermission/operationDataPermission",
    method: "post",
    data,
  });
};
/**
 * @name 删除数据权限
 * @param {*} dataPerId
 * @returns
 */
export const deleteDataPermission = (dataPerId) => {
  return service({
    url: "/jy-system/sysDataPermission/deleteDataPermission",
    method: "get",
    params: {
      dataPerId,
    },
  });
};

/**
 * @name 获取门店分页
 * @param {*} data 
 * @returns 
 */
export const storeSelectPage = (data = {page: { size: 9999, current: 1}}) => {
  return service({
    url: "/jy-system/api/store/selectPage",
    method: "post",
    data,
  });
};

/**
 * @name 数据结构-门店查询
 * @param {*} data 
 * @returns 
 */
export const dataGroupAuthStore = (data)=>{
  return service({
    url: "/jy-business/api/store/dataGroupAuthStore",
    method: "post",
    data,
  });
}



/**
 * 获取权限列表
 * @param {Obiect} data 
 * @returns 
 */
export const getPermissionList = (data) => {
  return service({
    url: "/jy-system/permission/getSysPermissionList",
    method: "post",
    data,
  });
}



/**
 * 新增-编辑权限
 * @param {Object} data 
 * @returns 
 */
export const addOrEditPermission = (data) => {
  return service({
    url:'/jy-system/permission/opsSysPermission',
    method:'post',
    data
  })
}



/**
 * 删除权限逻辑
 * @param {Object} data 
 * @returns 
 */
export const deletePermission = (params) => {
  return service({
    url:'/jy-system/permission/delSysPermission',
    method:'delete',
    params
  })
}

